<?php
namespace TLF\Tester\Test;
//@export_start(Example.Translator)
function translateGreeting($language){
switch ($language){
case "spanish":return "Hola";
case "german": return "Hallo";
case "english": return "Hello";
case "french": return "Bonjour";
default: return null;
}
}
//@export_end(Example.Translator)
//@export_start(Example.TranslatorTester)
class TranslatorTester extends \Taeluf\Tester{
//every function that starts with `test` will be run as a test
public function testTranslateSpanish(){
$actual = translateGreeting('spanish');
$target = "Hola";
echo "Target:{$target}\nActual:{$actual}";
if ($target==$actual)return true;
}
public function prepare(){
//this code runs BEFORE any of your test code
}
//You can declare other functions that DON'T start with `test` if you need helper functions.
}
//TranslatorTester::runAll() // just print the results
//TranslatorTester::run(['testTranslateSpanish']) // run every test method given in that array
// (new TranslatorTester())->run(); //runs all this way, or pass an array of methods to only run those tests
TranslatorTester::runAllToFile(__FILE__.'.html',$alsoPrint=true);
TranslatorTester::xdotoolRefreshFirefox(); // If you have xdotool installed, this will switch to Firefox & refresh focused webpage.
//@export_end(Example.TranslatorTester)